package com.haois.mp.database.module.offaccounts.rest;

import me.chanjar.weixin.common.exception.WxErrorException;
import com.haois.mp.database.module.basic.controller.BaseController;
import com.haois.mp.database.module.remote.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by RuiHaoZ on 2017/12/17 12:47
 */
@RestController
@RequestMapping("/wxmp/rest/notice")
public class NoticeRestController extends BaseController {
    @Autowired
    private INoticeService iNoticeService;


    @RequestMapping(value = "/getListByMem")
    public Map getListByMem(HttpServletRequest request) throws WxErrorException {
        String access_token = (String) request.getAttribute("access_token");
        Map result = iNoticeService.getByMem(access_token, getPagerParams(request));
        return result;
    }

    @RequestMapping(value = "/getListByOid")
    public Map getListByOid(String oid, HttpServletRequest request) throws WxErrorException {
        String access_token = (String) request.getAttribute("access_token");
        Map result = iNoticeService.getNoticeByOid(access_token, oid);
        return result;
    }


}
